Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwigComponent] escape nesting separator with :: #1959

Closed
wants to merge 2 commits into from

Conversation

kbond
Copy link
Member

@kbond kbond commented Jul 4, 2024

Q A
Bug fix? no
New feature? yes
Issues Fix (partial) #1839
License MIT

If you require a Twig component attribute that includes a : (like x-on:click) you'll trigger the nested attribute system. This PR allows escaping : with ::. So to render x-on:click="!open", you can to write x-on::click="!open".

@carsonbot carsonbot added Feature New Feature Status: Needs Review Needs to be reviewed labels Jul 4, 2024
@kbond kbond force-pushed the fix/dash-in-nested-attribute branch from b06bcaa to e647da1 Compare July 4, 2024 17:37
@kbond kbond changed the title feat: escape nesting separator with :: [TwigComponent] escape nesting separator with :: Jul 4, 2024
@@ -64,6 +64,8 @@ function (string $carry, string $key) {
$value = 'true';
}

$key = str_replace('::', ':', $key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a regex to enforce it's only for nested attributes ? (so after a word / before another one) ?

@smnandre
Copy link
Member

smnandre commented Jul 6, 2024

So we close this one or do we want to have both ?

@kbond
Copy link
Member Author

kbond commented Jul 6, 2024

I'm going to close this for now.

@kbond kbond closed this Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Status: Needs Review Needs to be reviewed TwigComponent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants